
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GameLogic;

import Enums.*;

/**
 *
 * @author Ollowain
 */
public abstract class Element
{
    protected int posX, posY;
    protected String texture;

    public Element( int posx, int posy , String tname)
    {
        posX = posx;
        posY = posy;
        texture = tname;
    }

    public int getPosX()
    {
        return posX;
    }

    public void setPosX( int posx )
    {
        posX = posx;
    }

    public int getPosY()
    {
        return posY;
    }

    public void setPosY( int posy )
    {
        posY = posy;
    }

    public String getTexture()
    {
        return texture;
    }

    public void setTexture( String newTexture )
    {
        texture = newTexture;
    }

    //die Richtung eines angrenzenden Elements von der eigenen Position aus herausfinden
    public Direction compare( Element compared )
    {
        if( this.posX == compared.getPosX() + 1 && this.posY == compared.getPosY() )
            return Direction.WEST;
        if( this.posX == compared.getPosX() - 1 && this.posY == compared.getPosY() )
            return Direction.EAST;
        if( this.posY == compared.getPosY() - 1 && this.posX == compared.getPosX() )
            return Direction.SOUTH;
        if( this.posY == compared.getPosY() + 1 && this.posX == compared.getPosX() )
            return Direction.NORTH;
        return null;
    }
}
